Removes all leading and trailing spaces from a string expression.
文字列表式の末尾および先頭にあるスペース記号を、すべて削除します。
Trim( Text As String )
Trim( Text As String )
String
文字列
Text: Any string expression.
Text: 処理をする文字列表現。
Sub ExampleSpaces
Sub ExampleSpaces
Dim sText2 as String,sText as String,sOut as String
Dim sText2 as String,sText as String,sOut as String
sText2 = " <*Las Vegas*> "
sText2 = " <*Las Vegas*> "
sOut = "'"+sText2 +"'"+ Chr(13)
sOut = "'"+sText2 +"'"+ Chr(13)
sText = Ltrim(sText2) REM sText = "<*Las Vegas*> "
sText = Ltrim(sText2) REM sText = "<*Las Vegas*> "
sOut = sOut + "'"+sText +"'" + Chr(13)
sOut = sOut + "'"+sText +"'" + Chr(13)
sText = Rtrim(sText2) REM sText = " <*Las Vegas*>"
sText = Rtrim(sText2) REM sText = " <*Las Vegas*>"
sOut = sOut +"'"+ sText +"'" + Chr(13)
sOut = sOut + "'"+sText +"'" + Chr(13)
sText = Trim(sText2) REM sText = "<*Las Vegas*>"
sText = Trim(sText2) REM sText = " <*Las Vegas*> "
sOut = sOut +"'"+ sText +"'"
sOut = sOut +"'"+ sText +"'"
MsgBox sOut
MsgBox sOut
end sub
end sub